package com.burst.reptile.modular.system.service.impl;

import com.burst.reptile.modular.system.entity.SysDictData;
import com.burst.reptile.modular.system.mapper.SysDictDataMapper;
import com.burst.reptile.modular.system.service.ISysDictDataService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.Arrays;
import java.util.List;

import org.springframework.stereotype.Service;

/**
 * <p>
 * 字典数据表 服务实现类
 * </p>
 *
 * @author wujin
 * @since 2020-05-22
 */
@Service
public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDictData> implements ISysDictDataService {

	@Override
	public List<SysDictData> selectDictDataByType(String dictType) {
		return this.baseMapper.selectList(new QueryWrapper<SysDictData>().eq("dict_status", "0")
				.eq("dict_type", dictType).orderByAsc("dict_sort"));
	}

	@Override
	public Page<SysDictData> selectPageDictDataList(Page<SysDictData> page, SysDictData dictData) {
		return this.baseMapper.selectPageDictDataList(page, dictData);
	}

	@Override
	public List<SysDictData> selectDictDataList(SysDictData dictData) {
		return this.baseMapper.selectDictDataList(dictData);
	}

	@Override
	public int insertDictData(SysDictData dictData) {
		return this.baseMapper.insert(dictData);
	}

	@Override
	public int updateDictData(SysDictData dictData) {
		return this.baseMapper.updateById(dictData);
	}

	@Override
	public int deleteDictDataByIds(Long[] dictCodes) {
		return this.baseMapper.deleteBatchIds(Arrays.asList(dictCodes));
	}
	

}
